﻿@model WaiGaoQiaoWeb.Models.InventoryInfoSelVM
@{
    ViewBag.Title = "InventoryInfoSelIndex";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    <script type="text/javascript" language="javascript">
        var maiheight = document.documentElement.clientHeight;
        var mainWidth = document.documentElement.clientWidth - 10; // 减去边框和左边的宽度
        $(document).ready(function () {
            var otherpm = $("#title").height() + $("#findDiv").height(); // 290;
            var gh = maiheight - otherpm - 80;
            var option = {
                height: gh,
                width: mainWidth,
                url: '@Url.Action("GetInventoryInfoSelList")', // 参数要放在）括号的外面
                dataType: 'json',
                colModel: [
                    { display: 'GOODSNO', name: 'GOODSNO', width: 70, sortable: false, hide: true, align: 'left', iskey: true },
                    { display: '食材名称', name: 'Goods_Name', width: 100, sortable: false, hide: false, align: 'left' },
					{ display: '单价', name: 'PRICE', width: 100, sortable: false, hide: false, align: 'left' },
                    { display: '数量', name: 'STOCKS_COUNT', width: 100, sortable: false, hide: false, align: 'left' }
				],
                title: false,
                singleselected: false,
                usepager: true,
                resizable: true,
                page: 1, //默认当前页  
                total: 1, //总页面数  
                useRp: true, //是否可以动态设置每页显示的结果数  
                rp: 1000, // 每页默认的结果数  
                rpOptions: [10, 15, 1000], //可选择设定的每页结果数
                showcheckbox: false,
                selectedonclick: true,
                rowbinddata: true,
                query: $("#txtGoodsName").val() + ',' + $("#Warehouse").val(),
                hideOnSubmit: true, //隐藏提交  
                autoload: true
            };
            $("#InventoryInfoSelList").flexigrid(option);
            $("#butfind").click(function (e) {
                var vgoodsname = ($("#txtGoodsName").val() == null) ? "" : $("#txtGoodsName").val();
                var vWarehouse = $("#Warehouse").val();
                option.query = vgoodsname + ',' + vWarehouse;
                option.newp = 0;
                $('#InventoryInfoSelList').flexOptions(option).flexReload();
            });
            function refreshGrid() {
                $("#InventoryInfoSelList").flexReload();
            }
        });
    </script>
}
<div id="container_sx">
    <div id="mainContent">
        <div id="findDiv">
            <table>
                <tr>
                    <td style="text-align: right;">
                        &nbsp;食材名称：
                    </td>
                    <td style="text-align: left;">
                        @Html.TextBox("txtGoodsName", "", new { @style = "width:180px;" })
                    </td>
                    <td style="text-align: right;">
                        &nbsp;食堂名称：
                    </td>
                    <td style="text-align: left;">
                        @Html.DropDownList("Warehouse",
                                      ViewData["GetWarehouse"] as IEnumerable<SelectListItem>,
                                      new { @style = "width:128px; height:22px; font-size:13px; vertical-align:middle;" })
                    </td>
                    <td>
                        <a id="butfind" class="button" href="javascript:void(0);"><span>查询</span></a>
                    </td>
                </tr>
            </table>
        </div>
        <table id="InventoryInfoSelList" style="display: none;">
        </table>
    </div>
</div>
